<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html>
<head>
<jsp:include page="../inc.jsp"></jsp:include>
<jsp:include page="../inc_bootstrap.jsp"></jsp:include>
<link rel="stylesheet" href="${ctx }/css/settlementQuery.css"/>

	<meta http-equiv="X-UA-Compatible" content="edge" />
<title>采购商押金报表</title>
<link rel="stylesheet" href="${ctx}/css/page.css"/>
<script type="text/javascript">
$(function(){
	//状态背景文字切换
	$(".listArg").click(function(){
		changeBack($(".listArg"),$(this));
	});
	//加载列表信息
	$('#table').bootstrapTable({
		url: '${ctx}/tradeList/despRepManage?temp='+Math.random(),
		dataType: "json",
		//contentType: "application/x-www-form-urlencoded",
		method: 'get',
		cache: false,
		height: "auto",//
		pagination: true,
		pageSize: 20,
		pageNumber:1,
		pageList: [ 20, 50, 100, 200, 500],
		striped: false,
		search: false,
		showColumns: false,
		showRefresh: false,
		clickToSelect: true,
		idField:'id',
		//toolbar: "#toolbar",
		paginationHAlign: 'left',
		paginationDetailHAlign: 'right',
		sidePagination: "server", //表示服务端请求
		queryParamsType : "undefined",
		//queryParams: queryParams,//参数
		columns: [
			{field:"id",title:"",align:"left",valign:"middle",visible:false},
			{field:"organizationName",title:"采购商",align:"left",valign:"middle"},
			{field:"contractNo",title:"合同编号",align:"left",valign:"middle"},
			{field:"aa",title:"航线",align:"left",valign:"middle",
				formatter : function(value,row,index){
					return CommonConverter.toEmptyString(row.deptAirPort)+"-<br/>"+CommonConverter.toEmptyString(row.arrAirport);
				}
			},
			{field:"productList",title:"产品列表",align:"left",valign:"middle"},
			{field:"tradeType",title:"类型",align:"left",valign:"middle",
				formatter:function(value,row,index){
					//	return CommonConverter.toTradeType(row.tradeType);
					switch(row.tradeType){
						case 0: return "票款";
						case 1: return "冻结";
						case 2: return "提现";
						case 3: return "充值";
						case 4: return "解冻";
						default: return "未知"
					}
				}
			},
			{field:"createTime",title:"日期",align:"left",valign:"middle"},
			{field:"cost",title:"金额（CNY）",align:"left",valign:"middle"},
			{field:"freezeAmount",title:"剩余押金(CNY)",align:"left",valign:"middle"}
		],
		formatNoMatches: function(){
			return '无符合条件的记录';
		}
	});
	//点击查询 重新加载列表
	$("#query").click(function(){
		//获取参数
		var organizationName=$("#organizationName").val();
		var contractNo=$("#contractNo").val();
		var param = {query:{
			pageNumber: 1,
			pageSize: 20,
			organizationName:organizationName,
			contractNo:contractNo
		}};
		$('#table').bootstrapTable('refresh',param);
		
	});
});
//导出表格
function exportExcel(){
	var organizationName=$("#organizationName").val();
	var contractNo=$("#contractNo").val();
	var url = "${ctx}/excel/exportSheets2?organizationName="+organizationName
	+"&contractNo="+contractNo
	+"&temp="+Math.random();
	window.location.href = url;
};
//封装函数  实现背景颜色及字体颜色切换
function changeBack(arg,$this){
	arg.css({
		"background": "#f1f1f1",
		"color": "black"
	});
	$this.css({
		"background": "#34c0e3",
		"color": "#FFFFFF"
	});
};

</script>
</head>
<body>
<jsp:include page="../head.jsp"/>
	<div class="content">
			<ul class="list">
				<li>采购商：
					<input type="text" id="organizationName">
				</li>
				<li>
					合同编号：<input type="text" id="contractNo">
				<li>
				<li class="right">
					<button class='query' onclick="exportExcel()">导出</button>
				</li>
				<li class="right">
					<button class='query' id="query" style="margin-right:5px;">查询</button>
				</li>
			</ul>
		<div class="setTabBox">
				<table id="table"></table>
		</div>
	</div>
<script type="text/javascript" src="${ctx }/jslib/airport/fixdiv.js"></script>
<script type="text/javascript" src="${ctx }/jslib/airport/address.js"></script>
<jsp:include page="../footer.jsp"/>
</body>
</html>